USE [Training]
GO

IF NOT EXISTS (SELECT * from dbo.sysobjects WHERE id = OBJECT_ID(N'dbo.training_api_DepartmentSelect'))
	EXEC('CREATE PROC dbo.training_api_DepartmentSelect AS')
GO

ALTER PROC dbo.training_api_DepartmentSelect
	@DepartmentID	int = null
AS
	SELECT
		DepartmentID,
		TITLE
	FROM Department
	WHERE
		(@DepartmentID IS NULL OR(DepartmentID = @DepartmentID))
